<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>项目人员-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .apply_list {
            border-bottom: 1px solid #e5e5e5;
        }

        .apply_list .form-item {
            width: 46%;
            padding: 10px 0;
        }

        .apply_list .form-item:last-child {
            width: 54%;
        }

        .apply_list:last-child {
            border-bottom: none;
        }

        .apply_list .input-label {
            width: 96px;
        }

        .apply_list .input-item {
            padding-left: 96px;
        }

        .border-h {
            height: 10px;
            background: #e5e5e5;
        }

        .ding .tooltip-inner {
            min-width: 180px;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">项目 > [{$result['project_num']}]{$result['project_name']} > 项目人员</div>
        <div class="right">
            <if condition="$ct gt 1"><span class="input-prompt mr10" style="color:#999"><i
                    class="glyphicon glyphicon-exclamation-sign"></i> 有未完结的增员申请，无法提交新的增员申请</span></if>
            <a href="javascript:;"
            <if condition="$ct gt 1">disabled
                <else/>
                onclick="apply_click()"
            </if>
            class="btn btn-add">增员申请</a>
        </div>
    </div>
    <div id="content">
        <include file="header"/>
        <div>
            <div class="form-main">
                <div class="form-title">项目人员情况</div>
                <div class="form-table-item">
                    <table class="table">
                        <tbody>
                        <tr class="form-table-header">
                            <td>用户名</td>
                            <td>职位</td>
                            <td>岗位</td>
                            <td>职级</td>
                            <td>性质</td>
                            <td>派驻日期</td>
                            <td>派出日期</td>
                            <if condition="$mid eq ''">
                                <td>管理</td>
                            </if>
                        </tr>
                        <foreach name="result_user" item="vo">
                            <tr class='gz_tr'>
                                <td>
                                    <if condition="$vo['quarters_remark'] neq ''"><a class="sim_alert"
                                                                                     href="javascript:;"
                                                                                     str="{$vo['quarters_remark']}">{$vo['username']}
                                        <if condition="$vo['u_status'] eq -1">(离职)</if>
                                    </a>
                                        <else/>
                                        {$vo['username']}
                                        <if condition="$vo['u_status'] eq -1">(离职)</if>
                                    </if>
                                </td>
                                <td>{$vo['position']}</td>
                                <td>{$vo['quarters']}</td>
                                <td>{$vo['rank']}</td>
                                <td>{$vo['nature']}</td>
                                <td>{$vo['come_date']}</td>
                                <td>{$vo['out_date']}</td>
                                <if condition="$mid eq ''">
                                    <td>
                                        <a href="javascript:;" mid="{$vo['id']}" class="btn-appoint">任命</a>
                                    </td>
                                </if>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                </div>
                <if condition="$mid eq ''">
                    <div class="form-title">增员申请</div>
                    <div class="form-table-item" style="overflow:initial;">
                        <table class="table">
                            <tbody>
                            <tr class="form-table-header">
                                <td>增员申请单号</td>
                                <td>职位</td>
                                <td>人数</td>
                                <td>岗位</td>
                                <td>职级</td>
                                <td>性质</td>
                                <td>期望到岗日期</td>
                                <td>计划离岗日期</td>
                                <td>申请理由</td>
                                <td width="100">状态</td>
                                <td>当前环节人员</td>
                                <td>管理</td>
                            </tr>
                            <if condition="$result_i eq NULL">
                                <tr>
                                    <td
                                            colspan="12" class="text-center">暂无相关内容
                                    </td>
                                </tr>
                            </if>
                            <foreach name="result_i" item="vo">
                                <foreach name="vo['detail']" item="wo" key="kk">
                                    <if condition="$key%2 eq 1">
                                        <tr class="interlaced-color">
                                            <else/>
                                        <tr>
                                    </if>
                                    <if condition="$kk eq 0">
                                        <td rowspan="{$vo['sum']}">{$vo['order_number']}</td>
                                    </if>
                                    <td>{$wo['position']}</td>
                                    <td>{$wo['pnum']}</td>
                                    <td>{$wo['quarters']}</td>
                                    <td>{$wo['rank_one']}
                                        <if condition="$wo['rank_two'] neq ''">~{$wo['rank_two']}</if>
                                    </td>
                                    <td>{$wo['nature']}</td>
                                    <td>{$wo['arrival_date']|substr=0,10}</td>
                                    <td>{$wo['leave_date']|substr=0,10}</td>
                                    <td>{$wo['reason']}</td>
                                    <if condition="$kk eq 0">
                                        <td rowspan="{$vo['sum']}" style="padding:0" class="ding">
                                            <div class="project_user_alert">
                                                <if condition="$vo['status'] eq -1">未提交
                                                    <if condition="$vo['dh_uid'] neq NULL"><span
                                                            title="{$vo['dh_user']}({$vo['dh_date']|substr=0,10}):{$vo['dh_message']}"
                                                            data-placement="right" data-toggle="tooltip" class="red">(已打回)<span>
                                                    </if>
                                                    <elseif condition="$vo['status'] eq 3"/>
                                                    已完结<i class="glyphicon glyphicon-exclamation-sign ml10"
                                                          style="color:#999"></i>
                                                    <else/>
                                                    进行中<i class="glyphicon glyphicon-exclamation-sign ml10"
                                                          style="color:#999"></i>
                                                </if>
                                                <if condition="$vo['status'] gt -1">
                                                    <div class="project_user_box">
                                                        <if condition="$vo['status'] neq -1">
                                                            <div class="project_user_title">审核流程</div>
                                                            <foreach name="vo['audit_arr']" item="vv">
                                                                <div class="p"><span
                                                                        class="bold">{$vv['audit_name']}</span>
                                                                    <if condition="$vv['audit_date'] neq NULL">
                                                                        <span>{$vv['audit_user']}({$vv['audit_date']|substr=0,10})<if
                                                                                condition="$vv['audit_comments'] neq NULL">:{$vv['audit_comments']}</if></span>
                                                                        <if condition="$vv['dh_message'] neq NULL"><br/><span>打回至"{$vv['arrive_name']}"({$vv['dh_date']|substr=0,10})原因:{$vv['dh_message']}</span>
                                                                        </if>
                                                                        <if condition="$vv['arrive_info'] neq NULL">
                                                                            <br/><span>"{$vv['arrive_name']}"({$vv['arrive_date']|substr=0,10})回复:{$vv['arrive_info']}</span>
                                                                        </if>
                                                                        <else/>
                                                                        <span class='red'>[未审核]{$vv['audit_user']}</span>
                                                                        <if condition="$vv['dh_message'] neq NULL"><br/><span
                                                                                class='red'>打回至"{$vv['arrive_name']}"({$vv['dh_date']|substr=0,10})原因:{$vv['dh_message']}</span>
                                                                        </if>
                                                                        <if condition="$vv['arrive_info'] neq NULL">
                                                                            <br/><span class='red'>"{$vv['arrive_name']}"({$vv['arrive_date']|substr=0,10})回复:{$vv['arrive_info']}</span>
                                                                        </if>
                                                                    </if>
                                                                </div>
                                                            </foreach>
                                                        </if>
                                                        <!--<if condition="$vo['dh_uid'] neq NULL">
                                                            <div class="p"><span class="red bold">打回原因 </span><span class="red">{$vo['dh_user']}({$vo['dh_date']|substr=0,10}):{$vo['dh_message']}</span></div>
                                                        </if>
                                                        <if condition="$vo['submit_info'] neq NULL">
                                                            <div class="p"><span class="red bold">重新提交 </span><span class="red">{$vo['submit_user']}:{$vo['submit_info']}</span></div>
                                                        </if>-->
                                                    </div>
                                                </if>
                                            </div>
                                        </td>
                                        <td rowspan="{$vo['sum']}">
                                            <if condition="$vo['audit_user'] neq NULL">{$vo['audit_user']}
                                                <else/>
                                                无
                                            </if>
                                        </td>
                                        <td rowspan="{$vo['sum']}">
                                            <if condition="$vo['status'] eq -1">
                                                <if condition="$vo['dh_message'] neq ''">
                                                    <a href="javascript:;" mid="{$vo['id']}" uuid="{$login_id}"
                                                       data-toggle="tooltip" data-placement="left" title="重新提交"
                                                       class="btn-rest-submit ml5"><i
                                                            class="glyphicon glyphicon-ok"></i></a>
                                                    <else/>
                                                    <a href="javascript:;" mid="{$vo['id']}" uuid="{$login_id}"
                                                       data-toggle="tooltip" data-placement="left" title="提交"
                                                       class="btn-submit ml5"><i class="glyphicon glyphicon-ok"></i></a>
                                                </if>
                                                <a href="javascript:;" mid="{$vo['id']}" action="delete"
                                                   data-toggle="tooltip" data-placement="left" title="删除"
                                                   class="btn-delete ml5"><i class="glyphicon glyphicon-trash"></i></a>
                                                <elseif condition="$vo['status'] eq 1"/>
                                                <a href="javascript:;" mid="{$vo['id']}" data-toggle="tooltip"
                                                   data-placement="left" title="放弃提交" class="btn-remove ml5"><i
                                                        class="glyphicon glyphicon-remove"></i></a>
                                            </if>
                                        </td>
                                    </if>
                                    </tr>
                                </foreach>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                    <else/>
                    <div class="form-title">增员审核</div>
                    <div class="form-table-item">
                        <table class="table">
                            <tbody>
                            <tr class="form-table-header">
                                <td>增员申请单号</td>
                                <td>职位</td>
                                <td>人数</td>
                                <td>岗位</td>
                                <td>职级</td>
                                <td>性质</td>
                                <td>期望到岗日期</td>
                                <td>计划离岗日期</td>
                                <td>申请理由</td>
                            </tr>
                            <foreach name="detail" item="wo" key="kk">
                                <if condition="$key%2 eq 1">
                                    <tr class="interlaced-color">
                                        <else/>
                                    <tr>
                                </if>
                                <if condition="$kk eq 0">
                                    <td rowspan="{$sum}">{$result_i[0]['order_number']}</td>
                                </if>
                                <td>{$wo['position']}</td>
                                <td>{$wo['pnum']}</td>
                                <td>{$wo['quarters']}</td>
                                <td>{$wo['rank_one']}
                                    <if condition="$wo['rank_two'] neq ''">~{$wo['rank_two']}</if>
                                </td>
                                <td>{$wo['nature']}</td>
                                <td>{$wo['arrival_date']|substr=0,10}</td>
                                <td>{$wo['leave_date']|substr=0,10}</td>
                                <td>{$wo['reason']}</td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                    <if condition="$result_i[0]['status'] neq -1">
                        <div class="form-sub-title">审核流程</div>
                        <foreach name="audit_user" item="vo">
                            <div class="form-item clearfix">
                                <div class="input-label">{$vo['audit_name']}</div>
                                <div class="input-item">
                                    <if condition="$vo['audit_date'] neq NULL">
                                        {$vo['audit_user']}({$vo['audit_date']|substr=0,10})
                                        <if condition="$vo['audit_comments'] neq NULL">:{$vo['audit_comments']}</if>
                                        <if condition="$vo['dh_message'] neq NULL"><br/><span>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span>
                                        </if>
                                        <if condition="$vo['arrive_info'] neq NULL"><br/><span>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span>
                                        </if>
                                        <else/>
                                        <span class='red'>[未审核]{$vo['audit_user']}</span>
                                        <if condition="$vo['dh_message'] neq NULL"><br/><span class='red'>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</span>
                                        </if>
                                        <if condition="$vo['arrive_info'] neq NULL"><br/><span class='red'>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</span>
                                        </if>
                                    </if>
                                </div>
                            </div>
                        </foreach>
                    </if>
                    <!--<if condition="$result_i[0]['dh_uid'] neq NULL">
                        <div class="form-item clearfix">
                            <div class="item-float">
                                <div class="input-label"><span class="red">打回原因</span></div>
                                <div class="input-item">
                                    <span class="red">{$result_i[0]['dh_user']}({$result_i[0]['dh_date']|substr=0,10}):{$result_i[0]['dh_message']}</span>
                                </div>
                            </div>
                        </div>
                    </if>
                    <if condition="$result_i[0]['submit_info'] neq NULL">
                        <div class="form-item clearfix">
                            <div class="item-float">
                                <div class="input-label"><span class="red">重新提交</span></div>
                                <div class="input-item">
                                    <span class="red">{$result_i[0]['submit_user']}:{$result_i[0]['submit_info']}</span>
                                </div>
                            </div>
                        </div>
                    </if>-->
                </if>
            </div>
            <if condition="$mid neq ''">
                <div class="form-btn-item">
                    <if condition="$result_i[0]['status'] egt 0">
                        <if condition="($shenhe eq 1)">
                            <button status="{$result_i[0]['status']}" mid="{$result_i[0]['id']}" uuid="{$login_id}"
                                    class="btn btn-audit2 mr5" type="button">审核
                            </button>
                            <button status="-1" mid="{$result_i[0]['id']}" uuid="{$login_id}" class="btn btn-back mr5"
                                    type="button">打回
                            </button>
                        </if>
                        <if condition="($qishen eq 1) and ($result_i[0]['status'] neq 3)">
                            <button status="{$result_i[0]['status']}" mid="{$result_i[0]['id']}"
                                    class="btn btn-giveup mr5" type="button">弃审
                            </button>
                        </if>
                    </if>
                </div>
            </if>
        </div>
    </div>
</div>
<!--重新提交框-->
<div class="modal fade" id="myModal_submit">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4>重新提交</h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body">
                <table class="table table-bordered">
                    <tr>
                        <td class="text-right" width="74"><strong><span class="asterisk">*</span>原因</strong></td>
                        <td>
                            <textarea name="remark" placeholder="重新提交理由" class="form-control w300 submit_info left"
                                      style="width:100%; height:150px" autocomplete="off"></textarea>
                            <span class="error-item left">必填项</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-affirm1">确认</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--弹框-->
<div class="modal fade" id="edit-modal">
    <div class="modal-dialog w600">
        <div class="modal-content">
            <div class="modal-header">
                <h4></h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body" style="line-height:30px;">
                <table class="table table-bordered">
                    <tr>
                        <td class="text-right" width="74"><strong><span class="asterisk">*</span>审核</strong></td>
                        <td>
                            <textarea name="text_hid" class="form-control required-text"
                                      style="width:100%; height:150px" autocomplete="off"></textarea>
                            <input type="hidden" name="audit_message">
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-affirm">确认</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--打回弹框-->
<div class="modal fade" id="back-modal">
    <div class="modal-dialog w600">
        <div class="modal-content">
            <div class="modal-header">
                <h4></h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body" style="line-height:30px;">
                <table class="table table-bordered">
                    <tr>
                        <td class="text-right" width="95"><strong><span class="asterisk">*</span>打回阶段</strong></td>
                        <td>
                            <select name="arrive_status" class="form-control required-selted" autocomplete="off">
                                <option value="-10" selected>请选择</option>
                                <foreach name="audit_list" item="vo">
                                    <option value="{$vo['audit_sort']}">{$vo['audit_name']}</option>
                                </foreach>
                            </select>
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right" width="95"><strong><span class="asterisk">*</span>是否重走流程</strong></td>
                        <td class="radios">
                            <label class="radio-inline"><input type="radio" name="flow_status" value="1"
                                                               autocomplete="off">是</label>
                            <label class="radio-inline"><input type="radio" name="flow_status" value="-1"
                                                               autocomplete="off">否</label>
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right" width="95"><strong><span class="asterisk">*</span>打回原因</strong></td>
                        <td>
                            <textarea name="dh_message" class="form-control required-text1"
                                      style="width:100%; height:150px" autocomplete="off"></textarea>
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-affirm2">确认</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--任命弹框-->
<div class="modal fade" id="add-modal">
    <div class="modal-dialog w600">
        <div class="modal-content">
            <div class="modal-header">
                <h4></h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body" style="line-height:30px;">
                <table class="table table-bordered">
                    <tr>
                        <td class="text-right" width="74"><strong><span class="asterisk">*</span>岗位</strong></td>
                        <td>
                            <select name="quarters" class="form-control required-selted" autocomplete="off">
                                <option value="-10">请选择</option>
                                <option value="管理岗">管理岗</option>
                                <option value="运营岗">运营岗</option>
                                <option value="营销岗">营销岗</option>
                                <option value="综合岗">综合岗</option>
                                <option value="机动岗">机动岗</option>
                            </select>
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right"><strong>人员提醒</strong></td>
                        <td>
                            <label class="checkbox-inline mr5"><input type="checkbox" name="is_msg" value="XM"
                                                                      autocomplete="off">是否人员提醒</label>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right"><strong><span class="asterisk">*</span>岗位职责</strong></td>
                        <td>
                            <textarea class="form-control w400 explain" name="quarters_remark"
                                      autocomplete="off"></textarea>
                            <span class="error-item">必填项</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn sub-appoint">确认</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!-- 增员申请 -->
<div class="modal fade" id="apply_add">
    <div class="modal-dialog w700">
        <div class="modal-content">
            <div class="modal-header">
                <h4>增员申请</h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body" style="line-height:30px;">
                <form id="apply_form" action="__APP__/Index/meeting_minutes_module_add" method="post"
                      enctype="multipart/form-data">
                    <input type="hidden" name="pid" value="{$result['pid']}"/>
                    <div class="apply_cont">
                        <div class="apply_list clearfix">
                            <div class="form-item left">
                                <div class="input-label"><span class="asterisk">*</span>职位</div>
                                <div class="input-item">
                                    <select name="position" class="form-control apply-selected w150" autocomplete="off">
                                        <option value="-10" selected>请选择</option>
                                        <foreach name="result4" item="vo">
                                            <option value="{$vo['second_name']}"
                                            <if condition="$vo['second_name'] eq $position">selected</if>
                                            >{$vo['second_name']}</option>
                                        </foreach>
                                    </select>
                                    <span class="error-item">必填项</span>
                                </div>
                            </div>
                            <div class="form-item left">
                                <div class="input-label"><span class="asterisk">*</span>人数</div>
                                <div class="input-item">
                                    <select name="pnum" class="form-control apply-selected w100" autocomplete="off">
                                        <option value="-10" selected>请选择</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="6">6</option>
                                        <option value="7">7</option>
                                        <option value="8">8</option>
                                    </select>
                                    <span class="error-item">必填项</span>
                                </div>
                            </div>
                            <div class="apply_list clearfix">
                                <div class="form-item left">
                                    <div class="input-label"><span class="asterisk">*</span>岗位</div>
                                    <div class="input-item">
                                        <select name="quarters" class="form-control apply-selected w150"
                                                autocomplete="off">
                                            <option value="-10" selected>请选择</option>
                                            <option value="管理岗">管理岗</option>
                                            <option value="运营岗">运营岗</option>
                                            <option value="营销岗">营销岗</option>
                                            <option value="综合岗">综合岗</option>
                                            <option value="机动岗">机动岗</option>
                                        </select>
                                        <span class="error-item">必填项</span>
                                    </div>
                                </div>
                                <div class="form-item left">
                                    <div class="input-label"><span class="asterisk">*</span>职级</div>
                                    <div class="input-item">
                                        <select name="rank_one" class="form-control w100" autocomplete="off">
                                            <option value="-10" selected>请选择</option>
                                            <foreach name="result5" item="vo">
                                                <option value="{$vo['second_name']}"
                                                <if condition="$vo['second_name'] eq $rank">selected</if>
                                                >{$vo['second_name']}</option>
                                            </foreach>
                                        </select>
                                        <span class="error-item">必填项</span>
                                        ~
                                        <select name="rank_two" class="form-control w100" autocomplete="off">
                                            <option value="-10" selected>请选择</option>
                                            <foreach name="result5" item="vo">
                                                <option value="{$vo['second_name']}"
                                                <if condition="$vo['second_name'] eq $rank">selected</if>
                                                >{$vo['second_name']}</option>
                                            </foreach>
                                        </select>
                                        <span class="error-item" style="display:block;">职级范围有误</span>
                                    </div>
                                </div>
                            </div>
                            <div class="apply_list clearfix">
                                <div class="form-item left">
                                    <div class="input-label">期望到岗日期</div>
                                    <div class="input-item">
                                        <input name="arrival_date" type="text"
                                               class="form-control Wdate apply-text w100" onclick="WdatePicker()"
                                               readonly="" autocomplete="off">
                                        <span class="error-item">必填项</span>
                                    </div>
                                </div>
                                <div class="form-item left">
                                    <div class="input-label">计划到岗日期</div>
                                    <div class="input-item">
                                        <input name="leave_date" type="text" class="form-control Wdate apply-text w100"
                                               onclick="WdatePicker()" readonly="" autocomplete="off">
                                        <span class="error-item">必填项</span>
                                    </div>
                                </div>
                            </div>
                            <div class="apply_list clearfix">
                                <div class="form-item left">
                                    <div class="input-label"><span class="asterisk">*</span>性质</div>
                                    <div class="input-item">
                                        <label class="radio-inline mr5"><input type="radio" name="nature" value="常驻"
                                                                               autocomplete="off">常驻</label>
                                        <label class="radio-inline mr5"><input type="radio" name="nature" value="临时"
                                                                               autocomplete="off">临时</label>
                                        <span class="error-item error-item1">必填项</span>
                                    </div>
                                </div>
                            </div>
                            <div class="apply_list clearfix">
                                <div class="form-item" style="width:680px">
                                    <div class="input-label"><span class="asterisk">*</span>申请理由</div>
                                    <div class="input-item">
                                        <textarea name="reason" class="form-control apply-text1"
                                                  style="width:500px; height:150px" autocomplete="off"></textarea>
                                        <span style="vertical-align:top" class="error-item">必填项</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn apply_sub">确认</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
</div>
<!--弹框-->
<div class="modal fade" id="min-modal">
    <div class="modal-dialog w600">
        <div class="modal-content">
            <div class="modal-header">
                <h4>岗位职责-<span></span></h4>
                <i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
            </div>
            <div class="modal-body clearfix" style="line-height:30px;">
                <span class="left" style="width:410px;"></span>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<include file="Include:javascript"/>
<script type="text/javascript">
    $(function () {
        $('.sim_alert').click(function () {
            $('#min-modal').modal();
            var str = $(this).attr('str'),
                txt = $(this).text();
            $('#min-modal .modal-body').find('span').html(str);
            $('#min-modal .modal-header').find('span').html(txt);
        })
        //增员申请
        var apply_clone = $('.apply_cont').eq(0).clone();

        $('.apply_sub').click(function () {
            var tag = true,
                one = $("[name='rank_one']").val(),
                two = $("[name='rank_two']").val();
            $('.apply-selected').each(function () {
                if ($(this).val() == -10) {
                    $(this).nextAll('.error-item').show();
                    tag = false;
                }
            })
            if ($("[name='nature']:checked").length < 1) {
                $(".error-item1").show();
                tag = false;
            }
            if ($("[name='reason']").val() == '') {
                $("[name='reason']").next('.error-item').show();
            }
            if ($("[name='rank_one']").val() == -10) {
                $("[name='rank_one']").nextAll('.error-item').eq(0).show();
            } else if ($("[name='rank_two']").val() != -10) {
                if (one == two) {
                    $("[name='rank_one']").nextAll('.error-item').eq(1).show();
                }
            }
            if (tag) {
                $.ajax({
                    cache: true,
                    type: "POST",
                    dataType: "json",
                    global: false,
                    url: "__APP__/Project/project_user_status",
                    data: $('#apply_form').serialize() + "&action=add",
                    success: function (data) {
                        console.log(data);
                        die;
                        $("#apply_add").hide();
                        success_pop(data['status'], data['msg']);
                    }
                });
            }
        })
        //任命
        $(".btn-appoint").on("click", function () {
            var modal = $("#add-modal"),
                name = $(this).parents('.gz_tr').find('td').eq(0).text();
            mid = $(this).attr('mid');
            modal.find('select').val('-10').select2();
            $("[name='is_msg']").prop("checked", false);
            $("[name='quarters_remark']").val('');
            modal.find(".modal-header h4").text("任命-" + name + "");
            modal.find(".file-name").prop("readonly", true);
            modal.find(".file-delete,.error-item").hide();
            modal.modal();
            $('.sub-appoint').attr('mid', mid);

        });
        $('.sub-appoint').click(function () {
            var tag = true;
            var val = $("#add-modal").find("[name='quarters']").val()
            if (val == -10) {
                tag = false;
                $("[name='quarters']").nextAll('.error-item').show();
            }
            if ($("[name='quarters_remark']").val() == '') {
                tag = false;
                $("[name='quarters_remark']").nextAll('.error-item').show();
            }
            if (tag) {
                if ($("[name='is_msg']:checked").length > 0) {
                    var is_msg = 1
                } else {
                    var is_msg = 2
                }
                var quarters = $("[name='quarters']").val(),
                    quarters_remark = $("[name='quarters_remark']").val(),
                    mid = $(this).attr('mid');
                $.ajax({
                    cache: true,
                    type: "POST",
                    dataType: "json",
                    global: false,
                    url: "__APP__/Project/project_user_status",
                    data: {
                        "is_msg": is_msg,
                        "quarters": quarters,
                        "quarters_remark": quarters_remark,
                        "mid": mid,
                        "action": "increase"
                    },
                    success: function (data) {
                        $("#add-modal").hide();
                        success_pop(data['status'], data['msg']);
                    }
                });
            }

        })
        //删除
        $(".btn-delete").ajaxModal({
            "title_text": "确认提示框",
            "body_text": "您确定要删除吗？",
            "url": "__APP__/Project/project_user_status",
            "data": {"id": "mid", "action": "action"}
        });
        $('.btn-submit').on("click", function () {
            var status = 1,
                uuid = $(this).attr("uuid"),
                state = 1,
                mid = $(this).attr("mid");
            $.ajax({
                cache: true,
                type: "POST",
                dataType: "json",
                url: "__APP__/Index/audit_list_ajax",
                data: {"mid": mid, "status": status, "uuid": uuid, "state": state},
                success: function (data) {
                    success_pop(data['status'], data['msg']);
                }
            });
        });
        $('.btn-remove').on("click", function () {
            var status = -1,
                state = 1,
                mid = $(this).attr("mid");
            $.ajax({
                cache: true,
                type: "POST",
                dataType: "json",
                url: "__APP__/Index/audit_list_ajax",
                data: {"mid": mid, "status": status, "state": state},
                success: function (data) {
                    success_pop(data['status'], data['msg']);
                }
            });
        });
        /*重新提交*/
        $(".btn-rest-submit").click(function () {
            var mid = $(this).attr("mid"),
                uuid = $(this).attr("uuid");
            $("#myModal_submit .btn-affirm1").attr("mid", mid);
            $("#myModal_submit .btn-affirm1").attr("uuid", uuid);
            $(".submit_info").removeClass("red").val("");
            $('#myModal_submit').modal('toggle');
        });

        $("#myModal_submit .btn-affirm1").click(function () {
            var status = 1,
                uuid = $(this).attr("uuid"),
                state = 1,
                mid = $(this).attr("mid"),
                submit_info = $(".submit_info").val();

            if (submit_info == "" || submit_info == "重新提交理由必填") {
                $(".submit_info").addClass("red").val("重新提交理由必填");
            } else {
                $('#myModal_submit').hide();
                $.ajax({
                    cache: true,
                    type: "POST",
                    dataType: "json",
                    url: "__APP__/Index/audit_list_ajax",
                    data: {"mid": mid, "status": status, "uuid": uuid, "state": state, "submit_info": submit_info},
                    success: function (data) {
                        success_pop(data['status'], data['msg']);
                    }
                });
            }
        });

        $(".submit_info").focus(function () {
            if ($(this).val() == "重新提交理由必填") {
                $(this).removeClass("red").val("");
            }
        });
        //隐藏错误提示
        $("[name='quarter'],[name='plan']").change(function () {
            $(this).parent().find('.error-item').hide();
        })
        $('.file-name').focus(function () {
            $(this).parents('.input-item').find('.error-item').hide();
        })

        $("[name='text_hid']").each(function () {
            var textss = $(this).text(),
                reg2 = new RegExp("<br/>", "g"),
                str = textss.replace(reg2, "\n");
            $(this).html(str);
        })
        //文本域暂存
        $("[name='text_hid']").blur(function () {
            var val = $(this).val();
            reg = new RegExp("\n", "g"),
                str = val.replace(reg, "<br/>");
            $("[name='audit_message']").val(str);
        })
        //审核弹框
        $(".btn-audit2").on("click", function () {
            var modal = $("#edit-modal"),
                mid = $(this).attr("mid"),
                uuid = $(this).attr("uuid"),
                status = parseInt($(this).attr('status')) + 1;
            modal.find(".modal-header h4").text("审核");
            modal.find(".file-name").prop("readonly", true);
            modal.find(".file-delete").hide();
            modal.find(".btn-affirm").attr({"mid": mid});
            modal.find(".btn-affirm").attr({"uuid": uuid});
            modal.find(".btn-affirm").attr({"status": status});
            modal.modal();
            modal.find("textarea").val('');
        });
        //取消
        $("#edit-modal").on('hidden.bs.modal', function () {
            $(this).find(".error-item").hide();
        });
        //审核
        $("#edit-modal").find(".btn-affirm").on("click", function () {
            var tag = false;
            $(".required-text").each(function () {
                var val = $(this).val();
                if (val == "" || /^\s+$/.test(val)) {
                    $(this).next(".error-item").show();
                    tag = true;
                }
            });

            if (tag) {
                return false;
            } else {
                var mid = $(this).attr("mid"),
                    uuid = $(this).attr("uuid"),
                    status = $(this).attr("status"),
                    audit_message = $("[name='audit_message']").val(),
                    modal = $("#edit-modal");
                modal.hide();
                $.ajax({
                    type: "POST",
                    async: false,
                    dataType: "json",
                    data: {"mid": mid, "audit_message": audit_message, "uuid": uuid, "status": status},
                    url: "__APP__/Index/audit_list_ajax",
                    success: function (data) {
                        success_pop(data.status, data.msg);
                    }
                });
            }
        });
        $(document).on("focus", ".required-text", function () {
            $(this).nextAll(".error-item").hide();
        });
        //打回
        $(".btn-back").on("click", function () {
            var modal = $("#back-modal"),
                mid = $(this).attr("mid"),
                uuid = $(this).attr("uuid"),
                status = $(this).attr("status");
            modal.find(".modal-header h4").text("打回");
            modal.find(".file-name").prop("readonly", true);
            modal.find(".file-delete").hide();
            modal.find(".btn-affirm2").attr({"mid": mid});
            modal.find(".btn-affirm2").attr({"uuid": uuid});
            modal.find(".btn-affirm2").attr({"status": status});
            modal.modal();
            modal.find("textarea").val('');
            modal.find("[name='arrive_status']").val('-10').select2();
            modal.find("[name='flow_status']").attr('checked', false);
        });
        //取消
        $("#back-modal").on('hidden.bs.modal', function () {
            $(this).find(".error-item").hide();
        });
        $("#back-modal").find(".btn-affirm2").on("click", function () {
            var tag = false;
            $(".required-text1").each(function () {
                var val = $(this).val();
                if (val == "" || /^\s+$/.test(val)) {
                    $(this).next(".error-item").show();
                    tag = true;
                }
            });
            $("[name='arrive_status']").each(function () {
                var val = $(this).val();
                if (val == -10) {
                    $(this).nextAll(".error-item").show();
                    tag = true;
                }
            })
            if ($("#back-modal").find("input:radio:checked").length == 0) {
                $("#back-modal .radios").find(".error-item").show();
                tag = true;
            }
            if (tag) {
                return false;
            } else {
                var modal = $("#back-modal"),
                    mid = $(this).attr("mid"),
                    uuid = $(this).attr("uuid"),
                    status = $(this).attr("status"),
                    dh_status = "{$result_i[0]['status']}",
                    dh_message = $("[name='dh_message']").val(),
                    arrive_status = $("[name='arrive_status']").val(),
                    flow_status = modal.find('input:radio:checked').val();

                modal.hide();
                $.ajax({
                    type: "POST",
                    async: false,
                    dataType: "json",
                    data: {
                        "mid": mid,
                        "dh_message": dh_message,
                        "uuid": uuid,
                        "status": status,
                        "flow_status": flow_status,
                        "arrive_status": arrive_status,
                        "dh_status": dh_status
                    },
                    url: "__APP__/Index/audit_list_ajax",
                    success: function (data) {
                        success_pop(data['status'], data['msg']);
                    }
                });
            }
        });
        $(document).on("focus", ".required-text1", function () {
            $(this).nextAll(".error-item").hide();
        });
        $("[name='arrive_status']").change(function () {
            $(this).nextAll(".error-item").hide();
        })
        $("#back-modal .radios label").click(function () {
            $("#back-modal .radios .error-item").hide();
        })
        //弃审
        $('.btn-giveup').on("click", function () {
            var status = $(this).attr('status'),
                mid = $(this).attr("mid");
            $.ajax({
                cache: true,
                type: "POST",
                dataType: "json",
                url: "__APP__/Index/audit_list_ajax",
                data: {"mid": mid, "status": status},
                success: function (data) {
                    success_pop(data['status'], data['msg']);
                }
            });
        });
        //提示隐藏
        $(".required-selted,.apply-selected,[name='rank_one'],[name='rank_two']").change(function () {
            $(this).nextAll('.error-item').hide();
        })
        $("[name='quarters_remark'],[name='reason']").focus(function () {
            $(this).next('.error-item').hide();
        })
        $("[name='nature']").click(function () {
            $('.error-item1').hide();
        })
    });

    function apply_click() {
        var modal = $("#apply_add");
        modal.modal();
        modal.find('.apply-clone').html('');
        modal.find('.error-item').hide();
        $(".apply-selected,[name='rank_one'],[name='rank_two']").val('-10').select2();
        $(".radio-inline input").prop("checked", false);
        $('.apply-text,.apply-text1').val('');
    }
</script>
</body>
</html>